/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.fatec.gilberto;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Vector;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

/**
 * @author gilberto
 */
public class HelloMIDlet extends MIDlet implements CommandListener {

    private boolean midletPaused = false;
//<editor-fold defaultstate="collapsed" desc=" Generated Fields ">//GEN-BEGIN:|fields|0|
    private Command exitCommand;
    private Command IniciarCommand;
    private Command registrarRefeiçãoCommand;
    private Command colsultarListaDiariaCommand;
    private Command itemCommand2;
    private Command ajudaCommand;
    private Command voltarInicialCommand;
    private Command listaVoltarCommand;
    private Command sairCommand;
    private Command voltarCommand;
    private Command sairCommand1;
    private Command voltarControleCalCommand;
    private Command voltarListaCommand;
    private Command AlimentosCommand;
    private Command VoltarListaAlimentoskCommand;
    private Form ControleCal;
    private ImageItem imageItem;
    private Form Inicial;
    private StringItem stringItem;
    private Form Ajuda;
    private List Lista;
    private List ListaAlimentos;
    private Image imageDelete;
//</editor-fold>//GEN-END:|fields|0|

    /**
     * The HelloMIDlet constructor.
     */
    public HelloMIDlet() {
    }

//<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//GEN-BEGIN:|methods|0|
//</editor-fold>//GEN-END:|methods|0|
//<editor-fold defaultstate="collapsed" desc=" Generated Method: initialize ">//GEN-BEGIN:|0-initialize|0|0-preInitialize
    /**
     * Initializes the application. It is called only once when the MIDlet is
     * started. The method is called before the
     * <code>startMIDlet</code> method.
     */
    private void initialize() {//GEN-END:|0-initialize|0|0-preInitialize
        // write pre-initialize user code here
//GEN-LINE:|0-initialize|1|0-postInitialize
        // write post-initialize user code here
        //carrega o arquivo especificado em "fileName"
    }//GEN-BEGIN:|0-initialize|2|
//</editor-fold>//GEN-END:|0-initialize|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Method: startMIDlet ">//GEN-BEGIN:|3-startMIDlet|0|3-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Started point.
     */
    public void startMIDlet() {//GEN-END:|3-startMIDlet|0|3-preAction
        // write pre-action user code here
        switchDisplayable(null, getControleCal());//GEN-LINE:|3-startMIDlet|1|3-postAction
        // write post-action user code here
    }//GEN-BEGIN:|3-startMIDlet|2|
//</editor-fold>//GEN-END:|3-startMIDlet|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Method: resumeMIDlet ">//GEN-BEGIN:|4-resumeMIDlet|0|4-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Resumed point.
     */
    public void resumeMIDlet() {//GEN-END:|4-resumeMIDlet|0|4-preAction
        // write pre-action user code here
//GEN-LINE:|4-resumeMIDlet|1|4-postAction
        // write post-action user code here
    }//GEN-BEGIN:|4-resumeMIDlet|2|
//</editor-fold>//GEN-END:|4-resumeMIDlet|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Method: switchDisplayable ">//GEN-BEGIN:|5-switchDisplayable|0|5-preSwitch
    /**
     * Switches a current displayable in a display. The
     * <code>display</code> instance is taken from
     * <code>getDisplay</code> method. This method is used by all actions in the
     * design for switching displayable.
     *
     * @param alert the Alert which is temporarily set to the display;
     * if <code>null</code>, then <code>nextDisplayable</code> is set
     * immediately
     * @param nextDisplayable the Displayable to be set
     */
    public void switchDisplayable(Alert alert, Displayable nextDisplayable) {//GEN-END:|5-switchDisplayable|0|5-preSwitch
        // write pre-switch user code here
        Display display = getDisplay();//GEN-BEGIN:|5-switchDisplayable|1|5-postSwitch
        if (alert == null) {
            display.setCurrent(nextDisplayable);
        } else {
            display.setCurrent(alert, nextDisplayable);
        }//GEN-END:|5-switchDisplayable|1|5-postSwitch
        // write post-switch user code here
    }//GEN-BEGIN:|5-switchDisplayable|2|
//</editor-fold>//GEN-END:|5-switchDisplayable|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Method: commandAction for Displayables ">//GEN-BEGIN:|7-commandAction|0|7-preCommandAction
    /**
     * Called by a system to indicated that a command has been invoked on a
     * particular displayable.
     *
     * @param command the Command that was invoked
     * @param displayable the Displayable where the command was invoked
     */
    public void commandAction(Command command, Displayable displayable) {//GEN-END:|7-commandAction|0|7-preCommandAction
        // write pre-action user code here
        if (displayable == Ajuda) {//GEN-BEGIN:|7-commandAction|1|38-preAction
            if (command == voltarInicialCommand) {//GEN-END:|7-commandAction|1|38-preAction
                // write pre-action user code here
                switchDisplayable(null, getInicial());//GEN-LINE:|7-commandAction|2|38-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|3|24-preAction
        } else if (displayable == ControleCal) {
            if (command == IniciarCommand) {//GEN-END:|7-commandAction|3|24-preAction
                // write pre-action user code here
                switchDisplayable(null, getInicial());//GEN-LINE:|7-commandAction|4|24-postAction
                // write post-action user code here
            } else if (command == exitCommand) {//GEN-LINE:|7-commandAction|5|19-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|7-commandAction|6|19-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|7|34-preAction
        } else if (displayable == Inicial) {
            if (command == ajudaCommand) {//GEN-END:|7-commandAction|7|34-preAction
                // write pre-action user code here
                switchDisplayable(null, getAjuda());//GEN-LINE:|7-commandAction|8|34-postAction
                // write post-action user code here
            } else if (command == registrarRefeiçãoCommand) {//GEN-LINE:|7-commandAction|9|28-preAction
                // write pre-action user code here
                switchDisplayable(null, getLista());//GEN-LINE:|7-commandAction|10|28-postAction
                // write post-action user code here
                BaseXML base = new BaseXML();
                try {
                    Vector cat = base.getCategorias();
                    System.out.println(cat.size());
                    for (int i = 0; i < cat.size(); i++) {

                        getLista().append(cat.elementAt(i).toString(), getImageDelete());
                        System.out.println(cat.elementAt(i).toString());
                    }
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
            } else if (command == voltarControleCalCommand) {//GEN-LINE:|7-commandAction|11|55-preAction
                // write pre-action user code here
                switchDisplayable(null, getControleCal());//GEN-LINE:|7-commandAction|12|55-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|13|78-preAction
        } else if (displayable == Lista) {
            if (command == AlimentosCommand) {//GEN-END:|7-commandAction|13|78-preAction
                // write pre-action user code here
                switchDisplayable(null, getListaAlimentos());//GEN-LINE:|7-commandAction|14|78-postAction
                // write post-action user code here
                BaseXML base = new BaseXML();
                String cat = getLista().getString(getLista().getSelectedIndex());
                try {
                    Alimento alimentos[] = base.getAlimentos(cat);
                    for (int i = 0; i < alimentos.length; i++) {
                        if(alimentos[i] !=null){
                            //Alimento almt = (Alimento) alimentos[i];
                            
                                System.out.println(alimentos[i].getNome());
                            
                            //getListaAlimentos().append(alimentos[i].getNome()+"ty", imageDelete);
                                
                        }
                    }
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
            } else if (command == List.SELECT_COMMAND) {//GEN-LINE:|7-commandAction|15|66-preAction
                // write pre-action user code here
                ListaAction();//GEN-LINE:|7-commandAction|16|66-postAction
                // write post-action user code here
            } else if (command == voltarListaCommand) {//GEN-LINE:|7-commandAction|17|70-preAction
                // write pre-action user code here
                switchDisplayable(null, getInicial());//GEN-LINE:|7-commandAction|18|70-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|19|75-preAction
        } else if (displayable == ListaAlimentos) {
            if (command == List.SELECT_COMMAND) {//GEN-END:|7-commandAction|19|75-preAction
                // write pre-action user code here
                ListaAlimentosAction();//GEN-LINE:|7-commandAction|20|75-postAction
                // write post-action user code here
                

            } else if (command == VoltarListaAlimentoskCommand) {//GEN-LINE:|7-commandAction|21|81-preAction
                // write pre-action user code here
                switchDisplayable(null, getLista());//GEN-LINE:|7-commandAction|22|81-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|23|7-postCommandAction
        }//GEN-END:|7-commandAction|23|7-postCommandAction
        // write post-action user code here
    }//GEN-BEGIN:|7-commandAction|24|
//</editor-fold>//GEN-END:|7-commandAction|24|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand ">//GEN-BEGIN:|18-getter|0|18-preInit
    /**
     * Returns an initialized instance of exitCommand component.
     *
     * @return the initialized component instance
     */
    public Command getExitCommand() {
        if (exitCommand == null) {//GEN-END:|18-getter|0|18-preInit
            // write pre-init user code here
            exitCommand = new Command("Sair", Command.EXIT, 0);//GEN-LINE:|18-getter|1|18-postInit
            // write post-init user code here
        }//GEN-BEGIN:|18-getter|2|
        return exitCommand;
    }
//</editor-fold>//GEN-END:|18-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: ControleCal ">//GEN-BEGIN:|14-getter|0|14-preInit
    /**
     * Returns an initialized instance of ControleCal component.
     *
     * @return the initialized component instance
     */
    public Form getControleCal() {
        if (ControleCal == null) {//GEN-END:|14-getter|0|14-preInit
            // write pre-init user code here
            ControleCal = new Form("ControleCal - Controle de Calorias", new Item[]{getImageItem()});//GEN-BEGIN:|14-getter|1|14-postInit
            ControleCal.addCommand(getExitCommand());
            ControleCal.addCommand(getIniciarCommand());
            ControleCal.setCommandListener(this);//GEN-END:|14-getter|1|14-postInit
            // write post-init user code here
        }//GEN-BEGIN:|14-getter|2|
        return ControleCal;
    }
//</editor-fold>//GEN-END:|14-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: IniciarCommand ">//GEN-BEGIN:|23-getter|0|23-preInit
    /**
     * Returns an initialized instance of IniciarCommand component.
     *
     * @return the initialized component instance
     */
    public Command getIniciarCommand() {
        if (IniciarCommand == null) {//GEN-END:|23-getter|0|23-preInit
            // write pre-init user code here
            IniciarCommand = new Command("Iniciar", Command.ITEM, 0);//GEN-LINE:|23-getter|1|23-postInit
            // write post-init user code here
        }//GEN-BEGIN:|23-getter|2|
        return IniciarCommand;
    }
//</editor-fold>//GEN-END:|23-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: registrarRefeiçãoCommand ">//GEN-BEGIN:|27-getter|0|27-preInit
    /**
     * Returns an initialized instance of registrarRefeiçãoCommand component.
     *
     * @return the initialized component instance
     */
    public Command getRegistrarRefeiçãoCommand() {
        if (registrarRefeiçãoCommand == null) {//GEN-END:|27-getter|0|27-preInit
            // write pre-init user code here
            registrarRefeiçãoCommand = new Command("Registrar Refei\u00E7\u00E3o", Command.ITEM, 0);//GEN-LINE:|27-getter|1|27-postInit
            // write post-init user code here

        }//GEN-BEGIN:|27-getter|2|
        return registrarRefeiçãoCommand;
    }
//</editor-fold>//GEN-END:|27-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: colsultarListaDiariaCommand ">//GEN-BEGIN:|29-getter|0|29-preInit
    /**
     * Returns an initialized instance of colsultarListaDiariaCommand component.
     *
     * @return the initialized component instance
     */
    public Command getColsultarListaDiariaCommand() {
        if (colsultarListaDiariaCommand == null) {//GEN-END:|29-getter|0|29-preInit
            // write pre-init user code here
            colsultarListaDiariaCommand = new Command("Consultar Consumo Di\u00E1rio", Command.ITEM, 0);//GEN-LINE:|29-getter|1|29-postInit
            // write post-init user code here
        }//GEN-BEGIN:|29-getter|2|
        return colsultarListaDiariaCommand;
    }
//</editor-fold>//GEN-END:|29-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: itemCommand2 ">//GEN-BEGIN:|31-getter|0|31-preInit
    /**
     * Returns an initialized instance of itemCommand2 component.
     *
     * @return the initialized component instance
     */
    public Command getItemCommand2() {
        if (itemCommand2 == null) {//GEN-END:|31-getter|0|31-preInit
            // write pre-init user code here
            itemCommand2 = new Command("Item", Command.ITEM, 0);//GEN-LINE:|31-getter|1|31-postInit
            // write post-init user code here
        }//GEN-BEGIN:|31-getter|2|
        return itemCommand2;
    }
//</editor-fold>//GEN-END:|31-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: ajudaCommand ">//GEN-BEGIN:|33-getter|0|33-preInit
    /**
     * Returns an initialized instance of ajudaCommand component.
     *
     * @return the initialized component instance
     */
    public Command getAjudaCommand() {
        if (ajudaCommand == null) {//GEN-END:|33-getter|0|33-preInit
            // write pre-init user code here
            ajudaCommand = new Command("Ajuda", Command.ITEM, 1);//GEN-LINE:|33-getter|1|33-postInit
            // write post-init user code here
        }//GEN-BEGIN:|33-getter|2|
        return ajudaCommand;
    }
//</editor-fold>//GEN-END:|33-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: voltarInicialCommand ">//GEN-BEGIN:|37-getter|0|37-preInit
    /**
     * Returns an initialized instance of voltarInicialCommand component.
     *
     * @return the initialized component instance
     */
    public Command getVoltarInicialCommand() {
        if (voltarInicialCommand == null) {//GEN-END:|37-getter|0|37-preInit
            // write pre-init user code here
            voltarInicialCommand = new Command("Voltar", Command.ITEM, 0);//GEN-LINE:|37-getter|1|37-postInit
            // write post-init user code here
        }//GEN-BEGIN:|37-getter|2|
        return voltarInicialCommand;
    }
//</editor-fold>//GEN-END:|37-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: listaVoltarCommand ">//GEN-BEGIN:|42-getter|0|42-preInit
    /**
     * Returns an initialized instance of listaVoltarCommand component.
     *
     * @return the initialized component instance
     */
    public Command getListaVoltarCommand() {
        if (listaVoltarCommand == null) {//GEN-END:|42-getter|0|42-preInit
            // write pre-init user code here
            listaVoltarCommand = new Command("Voltar", Command.ITEM, 0);//GEN-LINE:|42-getter|1|42-postInit
            // write post-init user code here
        }//GEN-BEGIN:|42-getter|2|
        return listaVoltarCommand;
    }
//</editor-fold>//GEN-END:|42-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: imageItem ">//GEN-BEGIN:|22-getter|0|22-preInit
    /**
     * Returns an initialized instance of imageItem component.
     *
     * @return the initialized component instance
     */
    public ImageItem getImageItem() {
        if (imageItem == null) {//GEN-END:|22-getter|0|22-preInit
            // write pre-init user code here
            imageItem = new ImageItem("imageItem", getImageDelete(), ImageItem.LAYOUT_DEFAULT, "<Missing Image>");//GEN-LINE:|22-getter|1|22-postInit
            // write post-init user code here
        }//GEN-BEGIN:|22-getter|2|
        return imageItem;
    }
//</editor-fold>//GEN-END:|22-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: Inicial ">//GEN-BEGIN:|25-getter|0|25-preInit
    /**
     * Returns an initialized instance of Inicial component.
     *
     * @return the initialized component instance
     */
    public Form getInicial() {
        if (Inicial == null) {//GEN-END:|25-getter|0|25-preInit
            // write pre-init user code here
            Inicial = new Form("ControleCal", new Item[]{getStringItem()});//GEN-BEGIN:|25-getter|1|25-postInit
            Inicial.addCommand(getRegistrarRefeiçãoCommand());
            Inicial.addCommand(getAjudaCommand());
            Inicial.addCommand(getVoltarControleCalCommand());
            Inicial.setCommandListener(this);//GEN-END:|25-getter|1|25-postInit
            // write post-init user code here
            //getDisplay().setCurrent(new Alert("Alertamos-nos"));



        }//GEN-BEGIN:|25-getter|2|
        return Inicial;
    }
//</editor-fold>//GEN-END:|25-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem ">//GEN-BEGIN:|26-getter|0|26-preInit
    /**
     * Returns an initialized instance of stringItem component.
     *
     * @return the initialized component instance
     */
    public StringItem getStringItem() {
        if (stringItem == null) {//GEN-END:|26-getter|0|26-preInit
            // write pre-init user code here
            stringItem = new StringItem("stringItem", null);//GEN-LINE:|26-getter|1|26-postInit
            // write post-init user code here
        }//GEN-BEGIN:|26-getter|2|
        return stringItem;
    }
//</editor-fold>//GEN-END:|26-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: Ajuda ">//GEN-BEGIN:|36-getter|0|36-preInit
    /**
     * Returns an initialized instance of Ajuda component.
     *
     * @return the initialized component instance
     */
    public Form getAjuda() {
        if (Ajuda == null) {//GEN-END:|36-getter|0|36-preInit
            // write pre-init user code here
            Ajuda = new Form("Ajuda");//GEN-BEGIN:|36-getter|1|36-postInit
            Ajuda.addCommand(getVoltarInicialCommand());
            Ajuda.setCommandListener(this);//GEN-END:|36-getter|1|36-postInit
            // write post-init user code here
        }//GEN-BEGIN:|36-getter|2|
        return Ajuda;
    }
//</editor-fold>//GEN-END:|36-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: sairCommand ">//GEN-BEGIN:|46-getter|0|46-preInit
    /**
     * Returns an initialized instance of sairCommand component.
     *
     * @return the initialized component instance
     */
    public Command getSairCommand() {
        if (sairCommand == null) {//GEN-END:|46-getter|0|46-preInit
            // write pre-init user code here
            sairCommand = new Command("Sair", Command.ITEM, 0);//GEN-LINE:|46-getter|1|46-postInit
            // write post-init user code here
        }//GEN-BEGIN:|46-getter|2|
        return sairCommand;
    }
//</editor-fold>//GEN-END:|46-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: sairCommand1 ">//GEN-BEGIN:|48-getter|0|48-preInit
    /**
     * Returns an initialized instance of sairCommand1 component.
     *
     * @return the initialized component instance
     */
    public Command getSairCommand1() {
        if (sairCommand1 == null) {//GEN-END:|48-getter|0|48-preInit
            // write pre-init user code here
            sairCommand1 = new Command("Sair", Command.EXIT, 0);//GEN-LINE:|48-getter|1|48-postInit
            // write post-init user code here
        }//GEN-BEGIN:|48-getter|2|
        return sairCommand1;
    }
//</editor-fold>//GEN-END:|48-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: voltarCommand ">//GEN-BEGIN:|51-getter|0|51-preInit
    /**
     * Returns an initialized instance of voltarCommand component.
     *
     * @return the initialized component instance
     */
    public Command getVoltarCommand() {
        if (voltarCommand == null) {//GEN-END:|51-getter|0|51-preInit
            // write pre-init user code here
            voltarCommand = new Command("Voltar", Command.BACK, 1);//GEN-LINE:|51-getter|1|51-postInit
            // write post-init user code here
        }//GEN-BEGIN:|51-getter|2|
        return voltarCommand;
    }
//</editor-fold>//GEN-END:|51-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: voltarControleCalCommand ">//GEN-BEGIN:|54-getter|0|54-preInit
    /**
     * Returns an initialized instance of voltarControleCalCommand component.
     *
     * @return the initialized component instance
     */
    public Command getVoltarControleCalCommand() {
        if (voltarControleCalCommand == null) {//GEN-END:|54-getter|0|54-preInit
            // write pre-init user code here
            voltarControleCalCommand = new Command("Voltar", Command.ITEM, 0);//GEN-LINE:|54-getter|1|54-postInit
            // write post-init user code here
        }//GEN-BEGIN:|54-getter|2|
        return voltarControleCalCommand;
    }
//</editor-fold>//GEN-END:|54-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: voltarListaCommand ">//GEN-BEGIN:|69-getter|0|69-preInit
    /**
     * Returns an initialized instance of voltarListaCommand component.
     *
     * @return the initialized component instance
     */
    public Command getVoltarListaCommand() {
        if (voltarListaCommand == null) {//GEN-END:|69-getter|0|69-preInit
            // write pre-init user code here
            voltarListaCommand = new Command("Back", Command.BACK, 0);//GEN-LINE:|69-getter|1|69-postInit
            // write post-init user code here
        }//GEN-BEGIN:|69-getter|2|
        return voltarListaCommand;
    }
//</editor-fold>//GEN-END:|69-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: Lista ">//GEN-BEGIN:|65-getter|0|65-preInit
    /**
     * Returns an initialized instance of Lista component.
     *
     * @return the initialized component instance
     */
    public List getLista() {
        if (Lista == null) {//GEN-END:|65-getter|0|65-preInit
            // write pre-init user code here
            Lista = new List("list", Choice.IMPLICIT);//GEN-BEGIN:|65-getter|1|65-postInit
            Lista.addCommand(getVoltarListaCommand());
            Lista.addCommand(getAlimentosCommand());
            Lista.setCommandListener(this);//GEN-END:|65-getter|1|65-postInit
            // write post-init user code here
        }//GEN-BEGIN:|65-getter|2|
        return Lista;
    }
//</editor-fold>//GEN-END:|65-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Method: ListaAction ">//GEN-BEGIN:|65-action|0|65-preAction
    /**
     * Performs an action assigned to the selected list element in the Lista
     * component.
     */
    public void ListaAction() {//GEN-END:|65-action|0|65-preAction
        // enter pre-action user code here
        String __selectedString = getLista().getString(getLista().getSelectedIndex());//GEN-LINE:|65-action|1|65-postAction
        // enter post-action user code here
    }//GEN-BEGIN:|65-action|2|
//</editor-fold>//GEN-END:|65-action|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: imageDelete ">//GEN-BEGIN:|73-getter|0|73-preInit
    /**
     * Returns an initialized instance of imageDelete component.
     *
     * @return the initialized component instance
     */
    public Image getImageDelete() {
        if (imageDelete == null) {//GEN-END:|73-getter|0|73-preInit
            // write pre-init user code here
            try {//GEN-BEGIN:|73-getter|1|73-@java.io.IOException
                imageDelete = Image.createImage("/br/com/fatec/gilberto/image/delete-16.png");
            } catch (java.io.IOException e) {//GEN-END:|73-getter|1|73-@java.io.IOException
                e.printStackTrace();
            }//GEN-LINE:|73-getter|2|73-postInit
            // write post-init user code here
        }//GEN-BEGIN:|73-getter|3|
        return imageDelete;
    }
//</editor-fold>//GEN-END:|73-getter|3|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: AlimentosCommand ">//GEN-BEGIN:|77-getter|0|77-preInit
    /**
     * Returns an initialized instance of AlimentosCommand component.
     *
     * @return the initialized component instance
     */
    public Command getAlimentosCommand() {
        if (AlimentosCommand == null) {//GEN-END:|77-getter|0|77-preInit
            // write pre-init user code here
            AlimentosCommand = new Command("Ok", Command.ITEM, 0);//GEN-LINE:|77-getter|1|77-postInit
            // write post-init user code here
        }//GEN-BEGIN:|77-getter|2|
        return AlimentosCommand;
    }
//</editor-fold>//GEN-END:|77-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: VoltarListaAlimentoskCommand ">//GEN-BEGIN:|80-getter|0|80-preInit
    /**
     * Returns an initialized instance of VoltarListaAlimentoskCommand
     * component.
     *
     * @return the initialized component instance
     */
    public Command getVoltarListaAlimentoskCommand() {
        if (VoltarListaAlimentoskCommand == null) {//GEN-END:|80-getter|0|80-preInit
            // write pre-init user code here
            VoltarListaAlimentoskCommand = new Command("Back", Command.BACK, 0);//GEN-LINE:|80-getter|1|80-postInit
            // write post-init user code here
        }//GEN-BEGIN:|80-getter|2|
        return VoltarListaAlimentoskCommand;
    }
//</editor-fold>//GEN-END:|80-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Getter: ListaAlimentos ">//GEN-BEGIN:|74-getter|0|74-preInit
    /**
     * Returns an initialized instance of ListaAlimentos component.
     *
     * @return the initialized component instance
     */
    public List getListaAlimentos() {
        if (ListaAlimentos == null) {//GEN-END:|74-getter|0|74-preInit
            // write pre-init user code here
            ListaAlimentos = new List("Alimentos", Choice.IMPLICIT);//GEN-BEGIN:|74-getter|1|74-postInit
            ListaAlimentos.addCommand(getVoltarListaAlimentoskCommand());
            ListaAlimentos.setCommandListener(this);//GEN-END:|74-getter|1|74-postInit
            // write post-init user code here
        }//GEN-BEGIN:|74-getter|2|
        return ListaAlimentos;
    }
//</editor-fold>//GEN-END:|74-getter|2|

//<editor-fold defaultstate="collapsed" desc=" Generated Method: ListaAlimentosAction ">//GEN-BEGIN:|74-action|0|74-preAction
    /**
     * Performs an action assigned to the selected list element in the
     * ListaAlimentos component.
     */
    public void ListaAlimentosAction() {//GEN-END:|74-action|0|74-preAction
        // enter pre-action user code here
        String __selectedString = getListaAlimentos().getString(getListaAlimentos().getSelectedIndex());//GEN-LINE:|74-action|1|74-postAction
        // enter post-action user code here
    }//GEN-BEGIN:|74-action|2|
//</editor-fold>//GEN-END:|74-action|2|

    /**
     * Returns a display instance.
     *
     * @return the display instance.
     */
    public Display getDisplay() {
        return Display.getDisplay(this);
    }

    /**
     * Exits MIDlet.
     */
    public void exitMIDlet() {
        switchDisplayable(null, null);
        destroyApp(true);
        notifyDestroyed();
    }

    /**
     * Called when MIDlet is started. Checks whether the MIDlet have been
     * already started and initialize/starts or resumes the MIDlet.
     */
    public void startApp() {
        if (midletPaused) {
            resumeMIDlet();
        } else {
            initialize();
            startMIDlet();
        }
        midletPaused = false;
    }

    /**
     * Called when MIDlet is paused.
     */
    public void pauseApp() {
        midletPaused = true;
    }

    /**
     * Called to signal the MIDlet to terminate.
     *
     * @param unconditional if true, then the MIDlet has to be unconditionally
     * terminated and all resources has to be released.
     */
    public void destroyApp(boolean unconditional) {
    }
}
